<!-- Top 10 miners -->
<h3><span data-tkey="top10miners">Top 10 miners</span></h3>

<ul class="nav nav-tabs" id="blocksTabs">
</ul>

<div class="tab-content" id="tab-content">
</div>

<script id="siblingTabTemplate" type="text/x-handlebars-template">
	<li id="blockTab{{coin}}" role="presentation" class="{{active}}"><a href="#{{coin}}" data-coin="{{coin}}">{{coin}} {{symbol}}</a></li>
</script>

<script id="siblingTemplate" type="text/x-handlebars-template">
	<div role="tabpanel" class="tab-pane {{active}}" id="{{coin}}">
        <div class="card">
            <div id="top10miners" class="table-responsive">
                <table class="table table-striped">
                    <thead>
                    <tr>
                        <th class="col1 sort">#</th>
                        <th class="col2 sort"><span data-tkey="miner">Miner</span></th>
                        <th class="col3 sort"><span data-tkey="hashRate">Hash Rate</span></th>
                        <th class="col4 sort"><span data-tkey="lastShare">Last Share Submitted</span></th>
                        <th class="col5 sort"><span data-tkey="totalHashes">Total Hashes Submitted</span></th>
                    </tr>
                    </thead>
                    <tbody id="top10miners_rows{{coin}}">
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</script>

<!-- Javascript -->
<script>
	let ranOnce = false
	let xhrGetMiners = {}
	// Update current page
	currentPage = {
		destroy: function () {
			if (xhrGetMiners) {
				Object.keys(xhrGetMiners)
					.forEach(key => {
						if (xhrGetMiners[key])
							xhrGetMiners[key].abort();
					})
			}
			$('#blocksTabs a')
				.off('click')
		},
		update: function (updateKey) {
			let endPoint = updateKey === parentCoin ? api : mergedApis[updateKey] ? mergedApis[updateKey].api : null
			if (endPoint) {
				top10Miners_UpdateTop10(xhrGetMiners, endPoint, updateKey)
			}
		}
	};

	function RunOnce () {
		$('#blocksTabs a')
			.click(function (e) {
				e.preventDefault()
				$(this)
					.tab('show')
			})
		return true
	}


	top10Miners_InitTemplate(xhrGetMiners, ranOnce)

</script>
